<template>
	<view class="contain">
		<!-- heightFix -->
		<view class="head w-[100%]"><image src="https://guangxins.oss-cn-shenzhen.aliyuncs.com/images/bg/buybg.jpg" mode="widthFix" style="width:100%;"></image></view>
		<view class="w-[100%] flex justify-center mt-2"><image src="https://guangxins.oss-cn-shenzhen.aliyuncs.com/images/fushuewm/yunyu2.png" mode="heightFix"></image></view>
		<view class="w-[100%] flex justify-center mt-2 text-xl">保存二维码到相册</view>
		<view class="w-[100%] flex justify-center mt-2 text-xl">使用微信扫码打开</view>
		<view class="w-[50%] m-auto flex justify-center mt-3">
			<u-button type="primary" shape="circle" text="保存到相册" @click="savePhoto"></u-button>
		</view>
	</view> <!-- contain -->
</template>

<script setup lang='ts'>
import { ref,reactive } from 'vue'
const savePhoto=()=>{
	uni.downloadFile({
		url: 'https://guangxins.oss-cn-shenzhen.aliyuncs.com/images/fushuewm/yunyu2.png', //仅为示例，并非真实的资源
		success: (res) => {
			console.log('下载结果',res);
			if (res.statusCode === 200) {
				console.log('下载成功',res);
				uni.saveImageToPhotosAlbum({
					filePath: res.tempFilePath,
					success: function () {
						console.log('save success');
						uni.$tools.Toast("已保存至相册，请使用微信打开扫码");
					}
				});
			}
		}
	});
}
</script>
<style>
	page{
		background:#f6eade;
	}
</style>
<style lang='scss' scoped>
	@import "savefushuewm.scss";
</style>